# -*- coding:utf-8 -*-
# @FileName  :per_report.py
# @Time      :2020/11/17 14:38
# @Author    :Zhoujirong
# @Desc      :

from common.http_request import Request
from biz.support.urls import ServerUrl

class PerReportRequest:
    @classmethod
    def per_info(cls,clientName,certType,certNo,assocbsnssData,note,queryFormat,resultType,qryReason,queryControlWarningType,serialNumber,cookie):
        data = {
            'clientName': clientName,
            'certType': certType,
            'certNo': certNo,
            'assocbsnssData': assocbsnssData,
            'note': note,
            'queryFormat': queryFormat,
            'resultType': resultType,
            'qryReason': qryReason,
            'queryControlWarningType': queryControlWarningType,
            'serialNumber': serialNumber
        }
        req = Request(ServerUrl.per_info_url, data=data,headers=cookie)
        return req.post()

    @classmethod
    def archive_create(cls, archiveType, Num, clientName, cretType, cretNo, startDate, expireDate, note, paperfileid,
                       filedescribe, cookie):
        data = {
            'archiveType': archiveType,
            'Num': Num,
            'clientName': clientName,
            'cretType': cretType,
            'cretNo': cretNo,
            'startDate': startDate,
            'expireDate': expireDate,
            'note': note,
            'paperfileid': paperfileid,
            'filedescribe': filedescribe
        }
        req = Request(ServerUrl.archive_create_url, data=data, headers=cookie)
        return req.post()

    @classmethod
    def save_paper(cls, paperfileid, filedescribe, archiveid, cookie):
        data = {
            "paperfileid": paperfileid,
            "filedescribe": filedescribe,
            "archiveid": archiveid
        }
        req = Request(ServerUrl.savepaper_url, data=data, headers=cookie)
        return req.post()

    @classmethod
    def per_checkinfo(cls, clientName, certType, certNo, assocbsnssData, note, queryFormat, resultType, qryReason,
                    queryControlWarningType, serialNumber, archiveId, cookie):
        data = {
            'clientName': clientName,
            'certType': certType,
            'certNo': certNo,
            'assocbsnssData': assocbsnssData,
            'note': note,
            'queryFormat': queryFormat,
            'resultType': resultType,
            'qryReason': qryReason,
            'queryControlWarningType': queryControlWarningType,
            'serialNumber': serialNumber,
            'archiveId': archiveId,
        }
        req = Request(ServerUrl.per_checkInfo_url, data=data, headers=cookie)
        return req.post()


    @classmethod
    def per_inquire(cls, clientName, certType, certNo, assocbsnssData, note, queryFormat, resultType, qryReason,
                    queryControlWarningType, serialNumber, archiveId, rekUser, rekPasword,
                    checkWay, autharchiveId, cookie):
        data = {
            'clientName': clientName,
            'certType': certType,
            'certNo': certNo,
            'assocbsnssData': assocbsnssData,
            'note': note,
            'queryFormat': queryFormat,
            'resultType': resultType,
            'qryReason': qryReason,
            'queryControlWarningType': queryControlWarningType,
            'serialNumber': serialNumber,
            'archiveId': archiveId,
            'rekUser': rekUser,
            'rekPasword': rekPasword,
            'checkWay': checkWay,
            'autharchiveId': autharchiveId
        }
        req = Request(ServerUrl.inquire_url, data=data, headers=cookie)
        return req.post()

    @classmethod
    def per_show_report(cls, clientName, certType, certNo, assocbsnssData, note, queryFormat, resultType,
                        qryReason, queryControlWarningType, serialNumber, archiveId, autharchiveId, checkId,
                        rekUser, checkWay, cookie):
        '''查人行报告'''
        data = {
            'clientName': clientName,
            'certType': certType,
            'certNo': certNo,
            'assocbsnssData': assocbsnssData,
            'note': note,
            'queryFormat': queryFormat,
            'resultType': resultType,
            'qryReason': qryReason,
            'queryControlWarningType': queryControlWarningType,
            'serialNumber': serialNumber,
            'archiveId': archiveId,
            'rekUser': rekUser,
            'checkId': checkId,
            'checkWay': checkWay,
            'autharchiveId': autharchiveId
        }
        req = Request(ServerUrl.per_showReport_url, data=data, headers=cookie)
        return req.post()

    @classmethod
    def per_show_credit(cls, recordId, creditId, cookie):
        '''查看报告'''
        data = {
            "recordId": recordId,
            "creditId": creditId
        }
        req = Request(ServerUrl.per_reveal_report_url, params=data, headers=cookie)
        return req.get_download()

    @classmethod
    def local_report(cls,clientName,
                        certType,
                        certNo,
                        assocbsnssData,
                        note,
                        queryFormat,
                        resultType,
                        qryReason,
                        queryControlWarningType,
                        serialNumber,
                        archiveId,
                        autharchiveId,
                        checkId,
                        rekUser,
                        checkWay,cookie):
        data = {
            'clientName':clientName,
            'certType':certType,
            'certNo':certNo,
            'assocbsnssData':assocbsnssData,
            'note':note,
            'queryFormat':queryFormat,
            'resultType':resultType,
            'qryReason':qryReason,
            'queryControlWarningType':queryControlWarningType,
            'serialNumber':serialNumber,
            'archiveId':archiveId,
            'autharchiveId':autharchiveId,
            'checkId':checkId,
            'rekUser':rekUser,
            'checkWay':checkWay
        }
        req = Request(ServerUrl.per_local_report_url,data=data,headers=cookie)
        return req.post()

    @classmethod
    def prevalidate(cls,pre,cookie):
        params = {
            'pre':pre
        }
        req = Request(ServerUrl.per_prevalidate_url,params=params,headers=cookie)
        return req.post()

    @classmethod
    def save(cls, creditId,recordId,cookie):
        '''保存信用报告'''
        data = {
            'creditId':creditId,
            'recordId':recordId
        }
        req = Request(ServerUrl.per_savereport_url,data=data,headers=cookie)
        return req.post_download()

    @classmethod
    def queryreportstatus(cls,creditId,recordId,cookie):
        '''获取状态'''
        params = {
            'creditId': creditId,
            'recordId': recordId
        }
        req = Request(ServerUrl.per_queryreportstatus_url,params=params,headers=cookie)
        return req.get_list()

    @classmethod
    def saverrintLog(cls,recordId,cookie):
        params = {
            'recordId':recordId
        }
        req = Request(ServerUrl.per_saverrintLog_url,params=params,headers=cookie)
        return req.post()

    @classmethod
    def printreport(cls,creditId,recordId,cookie):
        '''打印报告跳转'''
        params = {
            'creditId': creditId,
            'recordId': recordId
        }
        req = Request(ServerUrl.per_printreport_url, params=params, headers=cookie)
        return req.get()

    @classmethod
    def savepdfandresurl(cls,creditId,recordId,cookie):
        '''pdf的url'''
        data = {
            'creditId': creditId,
            'recordId': recordId
        }
        req = Request(ServerUrl.per_savepdfandresurl_url,data=data,headers=cookie)
        return req.post()







if __name__ == "__main__":
    pass